﻿using Bids.Core.DomainObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bids.Service
{
    public interface IUserContext
    {
        bool IsLogined { get;  }
        User User { get;  }
    }
    public class UserContext : IUserContext
    {
        IAuthenticationService _iAuthSrv;
        public UserContext(IAuthenticationService iAuthSrv)
        {
            _iAuthSrv = iAuthSrv;
        }
        public bool IsLogined
        {
            get
            {
                return _iAuthSrv.GetAuthenticatedUser() != null;
            }
        }
        public User User
        {
            get
            {
                return _iAuthSrv.GetAuthenticatedUser();
            }
        }
        
    }
}
